package com.ok.integral.controller;


import com.ok.common.utils.UserContext;
import com.ok.integral.domain.po.OkIntegral;
import com.ok.integral.service.IOkIntegralService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 积分表 前端控制器
 * </p>
 *
 * @author lhw
 * @since 2024-05-06
 */
@Api(tags = "积分相关接口")
@RestController
@RequestMapping("/integral")
@RequiredArgsConstructor
public class OkIntegralController {

    private final IOkIntegralService okIntegralService;

    @ApiOperation("*添加用户对应积分表")
    @PostMapping("/add")
    //添加@RequestParam，远程调用才能接收参数
    public void  add(@RequestParam("userId") Long userId) {
        okIntegralService.add(userId);
    }

    @ApiOperation("*修改用户积分")
    @PutMapping("/update")
    public void update(@RequestParam("integral") Double integral){
        okIntegralService.updateWith(integral);
    }

}
